<?php
/**
 * XmuSlh, web platform of Student Association Federation of Xiamen University
 * 
 * Rewritting one or some pages of StatusNet. 
 * To get the original version, please visit <http://status.net/>.
 * 
 * StatusNet, the distributed open-source microblogging tool
 * 
 * LICENCE: This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * The news action to show the subnews(inherited from BaseNews).
 * 
 * With a 'pigination' style, see if could make it a super class.
 * 
 * @author		ytukie <ytukie@gmail.com>
 * @version		0.3
 * 
 * 0.2)  Inherited from 'PaginationAction'.
 * 0.3)  Adds the slh_set_returnto functional in prepare().
 * 0.4)  Adds the 'showAddition' section.
 */

// XmuSlh only.
if ( !defined('XMUSLH')) { exit(1); }

// Requirements.
require_once INSTALLDIR . '/lib/slh_util.php';
require_once INSTALLDIR . '/lib/slh_paginationaction.php';

// Definitions.
define('PUBLICNEWS_PER_PAGE',			20);

define('MICRONEWS_PER_PAGE',			20);
define('NOTENEWS_PER_PAGE',				20);
define('EVENTNEWS_PER_PAGE',			10);
define('PHOTONEWS_PER_PAGE',			10);


class NewsAction extends PaginationAction
{
	/**
	 * The string name of the sub-action.
	 */
	var $subaction = null;
	
	/**
	 * Construtors.
	 * To gain some vairables of the sub-action.
	 * 
	 * @param
	 */
	function __construct($subaction,
						 $itemsperpage = DEFAULT_PER_PAGE)
	{
		parent::__construct($itemsperpage);
		
		$this->subaction = $subaction;
	}
	
	function prepare($args)
	{
		parent::prepare($args);
		
		// Set the returnto(current page) loaction for the news options.
		slh_set_returnto();

		return true;
	}
	
	function handle($args)
	{
		parent::handle($args);

		if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// FIXME: Return to default?
			;
		} else {
			$this->showPage();
		}
	}
	
	/**
	 * Overrideing the showInnerContent().
	 */
	function showInnerContent()
	{	
		$this->showAddition();
		$this->showNewsStream();
		
		// Pagination.
		$this->showPagination();
	}
	
// Overrided ends //////////////////////////////////////////////////////////////
	/**
	 * Show the operations or instructions of the list.
	 * SHOULD BE OVERRIDED.
	 */
	function showAddition()
	{
	}
	
	/**
	 * Show the stream of the news.
	 * SHOULD BE OVERRIDED.
	 */
	function showNewsStream()
	{
	}
}

?>